import axios from '@/plugins/axios';

// 创建实体实例
export function createEntityInstance(instanceData) {
    return axios.post('/create_entity_instance', instanceData);
}

// 获取指定文档的所有实体实例
export function getEntityInstances(documentId) {
    return axios.get(`/get_entity_instances/${documentId}`);
}

// 更新实体实例
export function updateEntityInstance(instanceId, documentId, isChecked) {
    return axios.put('/update_entity_instance', {
        instanceId: instanceId,
        documentId: documentId,
        isChecked: isChecked
    });
}

// 通过实体类ID批量更新所有实体实例
export function updateEntityInstancesByEntityId(documentId, entityId, isChecked) {
    return axios.put('/update_entity_instances_by_entity_id', {
        documentId: documentId,
        entityId: entityId,
        isChecked: isChecked
    });
}

// 删除单个实体实例
export function deleteEntityInstance(documentId, instanceId) {
    return axios.post('/delete_entity_instance', {
        documentId: documentId,
        instanceId: instanceId
    });
}

// 删除指定实体类的所有实例
export function deleteEntityInstancesByEntityId(documentId, entityId) {
    return axios.post('/delete_entity_instances_by_entity_id', {
        documentId: documentId,
        entityId: entityId
    });
}
